package com.xie.test;

import java.util.regex.Pattern;

/**
 * @author xiezhendong
 * @date 2021/11/2
 */
public class test5 {

    private static final Pattern mobilePattern2 = Pattern.compile("^([-0-9]{1,20})$");

    public static void main(String[] args) {
        System.out.println(matcherAction("13501722350"));
        System.out.println(matcherAction("aaa"));
        System.out.println(matcherAction("1234567890123456789"));
        System.out.println(matcherAction("12345678901234567890"));
        System.out.println(matcherAction("123456789012345678901"));
        System.out.println(matcherAction("1234-1234-123-4123"));

        System.exit(2);
    }

    private static boolean matcherAction(String s) {
        System.out.printf(s + " :   ");
        if (s.length() > 20) {
            return false;
        }
        return mobilePattern2.matcher(s).matches();
    }


}
